﻿using System.Linq.Expressions;
using Basic.UserRepository;

namespace Basic.UserCollect.lmpl
{
    internal class BaseCollect<T, IdentityId> : IBaseCollect<T, IdentityId> where T : class, new()
    {
        private readonly IUserBaseRepository<T, IdentityId> _Repository;

        public BaseCollect (IUserBaseRepository<T, IdentityId> repository)
        {
            this._Repository = repository;
        }

        public T Find (IdentityId id)
        {
            return this._Repository.Find(id);
        }

        public T Get (IdentityId id)
        {
            return this._Repository.Get(id);
        }
        public Result Get<Result> (IdentityId id) where Result : class
        {
            return this._Repository.Get<Result>(id);
        }
        public Result Get<Result> (IdentityId id, Expression<Func<T, Result>> selector)
        {
            return this._Repository.Get<Result>(id, selector);
        }
        public T[] Gets (IdentityId[] ids)
        {
            return this._Repository.Gets(ids);
        }
        public Result[] Gets<Result> (IdentityId[] ids) where Result : class
        {
            return this._Repository.Gets<Result>(ids);
        }
        public Result[] Gets<Result> (IdentityId[] ids, Expression<Func<T, Result>> selector)
        {
            return this._Repository.Gets<Result>(ids, selector);
        }
    }
}
